package com.yequan.thread.threadpool.mythreadpoolmanager;

import java.net.ConnectException;
import java.net.SocketTimeoutException;

/**
 * 线程池工具类
 *
 * @author yequan
 * @date 2019/12/02
 */
public class ThreadPoolUtil {

    /**
     * 判断是否超时或者网络方面的异常
     *
     * @param cause
     * @return
     */
    public static boolean isTimeoutThrowable(Throwable cause) {
        if (cause instanceof SocketTimeoutException || cause instanceof ConnectException) {
            return true;
        } else {
            return false;
        }
    }

}
